﻿using System.Collections.Generic;
using System.Linq;
using MaxStoreErp.Core.Extensions;
using MaxStoreShop.Domain.Directories;
using MaxStoreShop.Logic.RepositoriesContracts.Directories;

namespace MaxStoreShop.Dal.Repositories.Directories
{
    public class MeasureTypeRepository : RepositoryBase, IMeasureTypeRepository
    {
        public IEnumerable<MeasureType> GetAllMeasures()
        {
            return Context.MeasureTypes.AsNoTracking().NotDeleted();
        }

        public void DeleteMeasure(int measureType)
        {
            SafeDelete(Context.MeasureTypes.First(c => c.Id == measureType));
        }

        public void SaveMeasure(MeasureType measureType)
        {
            SaveEntity(measureType);
        }
    }
}
